from typing import List

from pydantic import BaseModel, Field

"""
Belong--接收前端参数的类
Description--与核心的下单流程相关，这里的类都位于第二级别
"""

"""
RELATED NEW UI STEP ONE
"""


class Parcel(BaseModel):
    """
   包裹信息
    """
    id: int = Field(None, description='包裹ID')
    weight: float = Field(..., description='重量')
    height: float = Field(..., description='高度')
    width: float = Field(..., description='宽度')
    long: float = Field(..., description='长度')
    weight_desc: str = Field(None, description='重量描述')
    volume_desc: str = Field(None, description='体积描述')


class ParcelDescAndValue(BaseModel):
    id: int = Field(None, description='包裹ID')
    desc: str = Field(None, description='描述')
    values: float = Field(None, description='总价值')


"""
RELATED NEW UI STEP TWO
"""


class OrderBy(BaseModel):
    """
    排序条件
    """
    price: str = Field(None, description='价格')
    courier: str = Field(None, description='承运商')
    aging: str = Field(None, description='时效')


class MailRouteFilter(BaseModel):
    """
    可用邮路过滤
    """
    order_code: str = Field(..., description='订单编码')
    send_method: str = Field(None, description='头程【dropoff，pickup，not_limit】')
    receive_method: str = Field(None, description='尾程【collect，delivery，not_limit】')
    time_from: int = Field(None, description='时效起始')
    time_to: int = Field(None, description='时效终止')
    valued_add_list: List[int] = Field(None, description='增值服务')
    courier_list: List[int] = Field(None, description='承运商')
    order_by: OrderBy = Field(None, description='排序条件')


"""
RELATED NEW UI STEP THREE
"""


class ExtraService(BaseModel):
    """
    增值服务
    """
    one_category: List[int] = Field(..., description='头尾程')
    two_category: List[int] = Field(None, description='增值服务')


"""
RELATED NEW UI STEP FOUR
"""


class Address(BaseModel):
    """
    地址
    """
    street: str = Field(..., description='街道')
    street2: str = Field(None, description='门牌号')
    first_name: str = Field(..., description='名')
    last_name: str = Field(..., description='姓')
    area_code: str = Field(..., description='区号')
    phone_number: str = Field(..., description='手机号')
    address_type: int = Field(..., description='地址类型 0 个人 1 公司')
    email: str = Field(..., description='邮箱')
    company_name: str = Field(None, description='公司名称 地址类型是公司时才会传递')


class InvoiceAddress(Address):
    """
    发票补充字段
    """
    invoice_postal_code_id: int = Field(..., description='发票邮寄邮编')
